using WEB.Model;
using Microsoft.EntityFrameworkCore;


var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers();

// 从配置文件中获取 MySQL 连接字符串
var conString = builder.Configuration.GetConnectionString("mysql");
// 配置数据库上下文，使用 MySQL 数据库，并自动检测服务器版本
builder.Services.AddDbContext<WebDbContext>(x => x.UseMySql(conString, ServerVersion.AutoDetect(conString)));

var app = builder.Build();

app.MapControllers();

app.Run();

